import java.util.ArrayList;
import java.util.List;

public class Teacher {
    String name;
    List<Course> myCourses = new ArrayList<>(); // 已开课程

    public Teacher(String name) {
        this.name = name;
    }


    public void openCourse(String courseName, int capacity) {
        Course course = new Course(courseName, capacity);
        course.teacher = this;
        myCourses.add(course);
        System.out.println(name + "成功开设课程：《" + courseName + "》（容量" + capacity + "人）");
    }


    public void showCourses() {
        System.out.println("\n" + name + "的已开课程：");
        for (Course c : myCourses) {
            System.out.printf("《%s》- 已选%d人/容量%d人\n", c.name, c.selectedNum, c.capacity);
        }
    }
}